package org.ch00.Entity;

import java.awt.*;
import java.util.ArrayList;

public class Phone {
    private String brand;
    private double price;
    private String name;
    private ArrayList<String> contacts;
    public void Internet(){
        System.out.println("上网");
    }
    public void message(String number, String message){
        for(String contact:contacts){
            if(contact.equals(number)){
                System.out.println("给"+contact+"发送信息："+message);
            }else{
                System.out.println("给匿名用户发送信息："+message);
            }
            break;
        }
    }

    public Phone() {
    }

    public Phone(String brand, double price, String name, ArrayList<String> contacts) {
        this.brand = brand;
        this.price = price;
        this.name = name;
        this.contacts = contacts;
    }

    @Override
    public String toString() {
        return "phone{" +
                "brand='" + brand + '\'' +
                ", price=" + price +
                ", name='" + name + '\'' +
                ", contacts=" + contacts +
                '}';
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ArrayList<String> getContacts() {
        return contacts;
    }

    public void setContacts(ArrayList<String> contacts) {
        this.contacts = contacts;
    }
}
